package com.fan.teamer.service;

import java.util.List;

import javax.inject.Inject;
import javax.inject.Named;

import org.springframework.transaction.annotation.Transactional;

import com.fan.teamer.model.dao.EventDao;
import com.fan.teamer.model.domain.Event;

@Named("eventService")
@Transactional(readOnly = true)
public class EventServiceImpl implements EventService {

	@Inject
	@Named("eventDao")
	private EventDao eventDao;

	public EventDao getEventDao() {
		return eventDao;
	}

	public void setEventDao(EventDao eventDao) {
		this.eventDao = eventDao;
	}

	@SuppressWarnings("rawtypes")
	@Override
	public List getList() {
		return eventDao.getAllEvents();
	}

	@Override
	public int getColumnsSize() {
		return eventDao.getColumnNames().size();
	}

	@Override
	public Object copy(Object obj) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Event getEvent(int id) {
		return eventDao.getEvent(id);
	}

	@Override
	public List<Event> getAllEvents() {
		return eventDao.getAllEvents();
	}

	@Override
	public int getSize() {
		return eventDao.getSize();
	}

	@Override
	@Transactional(readOnly = false)
	public void addEvent(Event event) {
		eventDao.addEvent(event);
	}

	@Override
	@Transactional(readOnly = false)
	public void updateEvent(Event event) {
		eventDao.updateEvent(event);
	}

	@Override
	@Transactional(readOnly = false)
	public void deleteEvent(Event event) {
		eventDao.deleteEvent(event);
	}

	@Override
	public boolean hasEvent(int id) {
		return eventDao.hasEvent(id);
	}

	@Override
	public List<String> getColumnNames() {
		return eventDao.getColumnNames();
	}

}
